package com.yanqu.road.entity.activity.silkroad.config;

import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.config.system.NormalWeightItem;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.property.PropertyHelper;
import com.yanqu.road.utils.string.StringUtils;

import java.util.ArrayList;
import java.util.List;

@FieldTypeAnnotation(tableName = "t_s_activity_silkroad_sea")
public class SilkRoadSeaConfig {
    @FieldTypeAnnotation(desc = "活动id", select = true, isIndex = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "海域", isIndex = true)
    private int type;
    @FieldTypeAnnotation(desc = "地图id", isIndex = true)
    private int mapId;
    @FieldTypeAnnotation(desc = "物品id", isIndex = true)
    private int id;
    @FieldTypeAnnotation(desc = "图标")
    private String icon;
    @FieldTypeAnnotation(desc = "名称")
    private String name;
    @FieldTypeAnnotation(desc = "随机列表")
    private String weights;
    private List<NormalWeightItem> randomList = new ArrayList<>();
    @FieldTypeAnnotation(desc = "打捞奖励")
    private String rewards;
    private List<List<Property>> randomRewards = new ArrayList<>();
    @FieldTypeAnnotation(desc = "随机数量")
    private int randmoNum;
    @FieldTypeAnnotation(desc = "品质")
    private int quality;
    @FieldTypeAnnotation(desc = "长宽")
    private String range;
    private List<Integer> rangeList = new ArrayList<>();
    @FieldTypeAnnotation(desc = "初始坐标")
    private String coordinate;
    private List<Integer> coordinateList = new ArrayList<>();
    @FieldTypeAnnotation(desc = "移动方向（0固定1左2右")
    private int moveType;
    @FieldTypeAnnotation(desc = "移动范围（x轴距离")
    private int moveRange;
    @FieldTypeAnnotation(desc = "速度,单位/秒")
    private int speed;
    @FieldTypeAnnotation(desc = "收钩速度,单位/秒")
    private int retractSpeed;
    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getMapId() {
        return mapId;
    }

    public void setMapId(int mapId) {
        this.mapId = mapId;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getWeights() {
        return weights;
    }

    public void setWeights(String weights) {
        this.weights = weights;
        if (!StringUtils.isNullOrEmpty(weights) && !weights.equals("0")) {
            this.randomList = NormalWeightItem.parseWeightItemList(weights);
        }
    }

    public String getRewards() {
        return rewards;
    }

    public void setRewards(String rewards) {
        this.rewards = rewards;
        if (!StringUtils.isNullOrEmpty(rewards) && !rewards.equals("0")) {
            this.randomRewards = PropertyHelper.parseNewStringToPropertyList(rewards);
        }
    }

    public List<List<Property>> getRandomRewards() {
        return randomRewards;
    }

    public List<NormalWeightItem> getRandomList() {
        return randomList;
    }

    public int getRandmoNum() {
        return randmoNum;
    }

    public void setRandmoNum(int randmoNum) {
        this.randmoNum = randmoNum;
    }

    public int getQuality() {
        return quality;
    }

    public void setQuality(int quality) {
        this.quality = quality;
    }

    public String getRange() {
        return range;
    }

    public void setRange(String range) {
        this.range = range;
        this.rangeList = StringUtils.stringToIntegerList(range, ";");
    }

    public int getWidth(){
        return this.rangeList.get(0);
    }

    public int getHeight(){
        return this.rangeList.get(1);
    }

    public String getCoordinate() {
        return coordinate;
    }

    public void setCoordinate(String coordinate) {
        this.coordinate = coordinate;
        this.coordinateList = StringUtils.stringToIntegerList(coordinate, ";");
    }

    public int getX(){
        return this.coordinateList.get(0);
    }

    public int getY(){
        return this.coordinateList.get(1);
    }

    public int getMoveType() {
        return moveType;
    }

    public void setMoveType(int moveType) {
        this.moveType = moveType;
    }

    public int getMoveRange() {
        return moveRange;
    }

    public void setMoveRange(int moveRange) {
        this.moveRange = moveRange;
    }

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public int getRetractSpeed() {
        return retractSpeed;
    }

    public void setRetractSpeed(int retractSpeed) {
        this.retractSpeed = retractSpeed;
    }
}
